package com.example.fw;

import java.util.Properties;

public class AppManager {
	
	private static AppManager singleton;
	
	private WebDriverHelper webDriverHelper;
	private GroupHelper groupHelper;
	private ContactHelper contactHelper;
	private NavigationHelper navigationHelper;

	private Properties props;
	
	public static AppManager getInstance() {
		if (singleton == null){
			singleton = new AppManager();
		}
		return singleton;
	}
	
	public void stop() {
		if (webDriverHelper != null) {
		webDriverHelper.stop();
		}
	}
	public WebDriverHelper getWebDriverHelper() {
		if(webDriverHelper == null){
			webDriverHelper = new WebDriverHelper(this);
		}
		return webDriverHelper;
	}
	public GroupHelper getGroupHelper() {
		if(groupHelper == null){
			groupHelper = new GroupHelper(this);
		}
		return groupHelper;
	}
	public ContactHelper getContactHelper() {
		if(contactHelper == null){
			contactHelper = new ContactHelper(this);
		}
		return contactHelper;
	}
	public NavigationHelper getNavigationHelper() {
		if(navigationHelper == null){
			navigationHelper = new NavigationHelper(this);
		}
		return navigationHelper;
	}

	public void setProperties(Properties props) {
		this.props = props;
	}
	public String getProperty(String key) {
		return props.getProperty(key);
	} 
	public String getProperty(String key, String defaultValue) {
		return props.getProperty(key, defaultValue);
	} 
}